from locust import task, HttpUser, TaskSet


class one(TaskSet):
    token = ''

    def login(self):
        url = 'http://10.59.9.14:7003/api/public/login'
        data = {"username": "17371517889", "password": "123456789"}
        res = TaskSet.client.post(url=url, data=data)
        one.token = res.json['data']['token']


class w(HttpUser):
    host = '10.59.9.14:7003'
    tasks = [one]


if __name__ == '__main__':
    import os

    os.system(r'locust -f D:\python_vv\gao3\day20Pro.py')
